import {request} from "./request";

// 添加地址
export function addAddress(params: { name: string, address: string,
    phone: string, province: string, city: string,
    county: string, is_default: number }) {
    // 返回地址
    return request({
        url: "/api/address",
        method: "post",
        params
    });
}

// 编辑地址
export function editAddress(id: number, params: {
    name: string,
    address: string, phone: string, province: string,
    city: string, county: string, is_default: number
}) {
    // 返回地址
    return request({
        url: `/api/address/${id}`,
        method: "PUT",
        params
    });
}

// 删除地址
export function deleteAddress(id: number) {
    // 返回地址
    return request({
        url: `/api/address/${id}`,
        method: "DELETE"
    });
}

// 获取地址列表
export function getAddressList() {
    // 返回地址
    return request({
        url: "/api/address"
    });
}

// 地址详情
export function getAddressDetail(id: number) {
    // 返回地址
    return request({
        url: `/api/address/${id}`,
        method: "GET"
    });
}
